{template header}

<div class="container">

    <ol class="breadcrumb">
        <li><a href="{SITE_URL}">首页</a></li>
        <li><a href="{tsUrl('group')}">小组</a></li>
        <li><a href="{tsUrl('group','show',array('id'=>$strGroup['groupid']))}">{$strGroup['groupname']}</a></li>
        <li class="active">{if $usertype==0}{$strGroup['role_user']}{/if}{if $usertype==1}活跃{$strGroup['role_user']}{/if}{if $usertype==2||$usertype==3}馆东{/if}{if $usertype==4}教练{/if}</li>
    </ol>

<div class="row">

<div class="col-md-8">



    <div class="panel panel-default">
        <div class="panel-heading  menu">
            <a href="{tsUrl('group','user',array('id'=>$strGroup['groupid']))}" {if (!$usertype)}class="active"{/if}>{$strGroup['role_user']}</a> {if $strGroup['isplace']>0}| <a href="{tsUrl('group','user',array('id'=>$strGroup['groupid'],'usertype'=>1))}" {if ($usertype==1)}class="active"{/if} >活跃馆员</a>{/if}{if $strGroup['isplace']==2} |  <a href="{tsUrl('group','user',array('id'=>$strGroup['groupid'],'usertype'=>2))}" {if ($usertype==2)}class="active"{/if} >馆东</a> |  <a href="{tsUrl('group','user',array('id'=>$strGroup['groupid'],'usertype'=>3))}" {if ($usertype==3)}class="active"{/if} >待确认馆东</a> |  <a href="{tsUrl('group','user',array('id'=>$strGroup['groupid'],'usertype'=>4))}" {if ($usertype==4)}class="active"{/if} >教练</a> {/if}
            {if $TS_USER['isadmin']==1}
                <a style="float: right" data-toggle="modal" data-target="#add_member_box">添加成员</a>
            {/if}

        </div>
        <div class="panel-body">



<div class="facelist">

<ul>
    {if $arrGroupUser}
{loop $arrGroupUser $key $item}
<li>
<a href="{tsUrl('user','duty',array('id'=>$item[userid],'groupid'=>$groupid))}"><img class="img-circle" alt="{$item[username]}" src="{$item[face]}" width="48" height="48" /></a>
<p class="username">
    {$item[username]}
    {if $item['isstock']==1||$item['isstock']==2}&nbsp;{if $TS_USER['isadmin']==1 && $usertype==2 }<a  onclick="setStock('{$strGroup[groupid]}','{$item['userid']}','{$_SESSION['token']}','0')">{/if}<i class="fa fa-superpowers" style="color: #ff9800"></i>{if TS_USER['isadmin']==1 && $usertype==2 }</a>{/if}{/if}
    {if $item['isstock']==-1}&nbsp;{if $TS_USER['isadmin']==1 && $usertype==3}<a href="" onclick="setStock('{$strGroup[groupid]}','{$item['userid']}','{$_SESSION['token']}','1')">{/if}<i class="fa fa-superpowers" style="color: grey"></i>{if TS_USER['isadmin']==1 && $usertype==3 }</a>{/if}{/if}
</p>
<p>
{if $strGroup['userid']==$TS_USER['userid'] || $TS_USER['isadmin']==1}

{if $item['isadmin']==1}
<a href="javascript:void('0');" onclick="setAdmin('{$strGroup[groupid]}','{$item['userid']}','{$_SESSION['token']}','0')" title="取消管理员"><i class="fa fa-caret-square-o-down" aria-hidden="true"></i></a>
{elseif $item['isadmin']==0 && $strGroup['userid']!=$item['userid']}
<a href="javascript:void('0');" onclick="setAdmin('{$strGroup[groupid]}','{$item['userid']}','{$_SESSION['token']}','1')" title="设为管理员"><i class="fa fa-caret-square-o-up" aria-hidden="true"></i> </a>
{if $usertype==4}
    <a href="javascript:void('0');" onclick="returnGroup('{$strGroup['groupid']}','{$item['userid']}')" title="请回">&nbsp;<i class="fa fa-reply"></i> </a>

{/if}
<a href="javascript:void('0');" onclick="kickedGroup('{$strGroup['groupid']}','{$item['userid']}')" title="踢出">&nbsp;<i class="fa fa-times"></i> </a>

{/if}


{/if}
</p>
</li>
{/loop}
    {else}
    <li>暂无</li>

    {/if}
</ul>

</div>


<div class="clear"></div>
            <div class="page">{$pageUrl}</div>


</div>
</div>



</div>


<div class="col-md-4">


    <div class="panel panel-default">
        <div class="panel-heading">{$strGroup['groupname']}{$strGroup['role_leader']}</div>
        <div class="panel-body">


            <a class="nbg" href="{tsUrl('user','duty',array('id'=>$strLeader[userid]))}"><img class="img-circle" alt="{$strLeader[username]}" src="{$strLeader[face]}" width="48" height="48" /></a>
            <p>{$strLeader[username]}</p>
        </div>
    </div>


    <div class="panel panel-default">
        <div class="panel-heading">{$strGroup['groupname']}{$strGroup['role_admin']}</div>
        <div class="panel-body">

{if $arrAdmin}
            <div class="facelist">
                <ul>
                    {loop $arrAdmin $key $item}
                    <li>
                        <a href="{tsUrl('user','duty',array('id'=>$item[userid]))}"><img class="img-circle" alt="{$item[username]}" src="{$item[face]}" width="48" height="48" /></a>
                        <p>{$item[username]}</p>
                        <p>{if $strGroup['userid']==$TS_USER['userid'] || $TS_USER['isadmin']==1}

                            <a href="javascript:void('0');" onclick="setAdmin('{$strGroup[groupid]}','{$item['userid']}','{$_SESSION['token']}')">
                                {if $item['isadmin']==1}
                                取消{$strGroup['role_admin']}
                                {elseif $item['isadmin']==0}
                                设为{$strGroup['role_admin']}
                                {/if}
                            </a>
                            {/if}</p>
                    </li>
                    {/loop}
                </ul>
            </div>

            {else}
            暂无
            {/if}

        </div>
    </div>




    <div class="clear"></div>
    <!--广告位-->
    {php doAction('gobad','300')}


</div>
</div>
</div>

<div id="add_member_box" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h5 class="modal-title">请输入用户ID</h5>
            </div>
            <div class="modal-body" >
                <form  id="add-member" class="form-horizontal" method="post" action="{SITE_URL}index.php?app=group&ac=do&ts=invite">
                    <div class="form-group">
                        <div class="col-sm-9">
                            <input type="text" id="userid" name="userid" class="form-control">
                        </div>
                        </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <input type="hidden" id="groupid" name="groupid" value="{$groupid}" class="form-control">
                            <button type="submit" class="btn btn-success">点击提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    $(function(){
        $('#add-member').on('submit', function(e) {
        var userid  = $('#userid').val();
        var groupid  = $('#groupid').val();
            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=group&ac=do&ts=invite",
                data: "userid="+userid+'&groupid='+groupid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        });
    });
</script>

{template footer}